#pragma once

#include <d3d9.h>


struct D3DXVECTOR3;

class CLight
{
private:
   static UINT s_nextAvailableNo;

   UINT m_lightNo;

   IDirect3DDevice9& m_d3Device;
   D3DLIGHT9 m_lightDesc;
   bool m_enabled;

   bool m_dirty;

public:
   CLight(IDirect3DDevice9& d3Device, D3DLIGHTTYPE lightType);

   void update();

   void enable(bool val) {m_enabled = val;}
   bool isEnabled() const {return m_enabled;}

   void setAmbientColor(float r, float g, float b);
   void setDiffuseColor(float r, float g, float b);
   void setSpecularColor(float r, float g, float b);
   void setDirection(const D3DXVECTOR3& vec);
   void setPosition(const D3DXVECTOR3& vec);
   void setAttenuation(float constant, float linear, float quadratic);
   void setRange(float range);
   void setSpotLightFeatures(float fallof, float theta, float phi);
};
